﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using CanDoo.Data.Entity;
using CanDoo.Oil.Core.Models;

namespace CanDoo.Oil.Core.ModelConfigurations
{
    /// <summary>
    /// 实体类-数据表映射——报损单明细
    /// </summary>
    public class LossReportDetailConfiguration : EntityConfigurationBase<LossReportDetail>
    {
        /// <summary>
        /// 初始化一个<see cref="LossReportDetailConfiguration"/>类型的新实例
        /// </summary>
        public LossReportDetailConfiguration()
        {
             ToTable("store_LossReportDetail");
             this.Property(p => p.LossReportId).HasColumnName("LossReportId");
             this.HasRequired(p => p.LossReport).WithMany(n=>n.LossReportDetails).HasForeignKey(p => p.LossReportId).WillCascadeOnDelete(false);

             this.Property(p => p.ProductId).HasColumnName("ProductId");
             this.HasRequired(p => p.Product).WithMany().HasForeignKey(p => p.ProductId).WillCascadeOnDelete(false);

        }
    }
}
